package BanyuanClub.Study.Day0225;

/**
 * throw 手动抛出异常的动作
 * throws 抛出异常的声明
 */
public class TextThrow {
    public static void main(String[] args) {
        method(-1);
    }

    public static void method(int n){
        if(n > 0){
            System.out.println(n);
        }
        else{
            //手动抛出异常
            throw new IllegalArgumentException("n必须大于0");
        }
    }
}
